//双向循环链表库
#include <iostream>
#include <cstdlib>

#ifndef DBCLIST_H
#define DBCLIST_H

#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2

typedef int Status;

template <class ElemType>
struct LNode{
	ElemType data;
	struct LNode *next, *pre;
};

template <class ElemType>
class DbcList
{
private:
	struct LNode<ElemType> *head;
public:
	bool reverse;
	DbcList();
	Status InitList();
	Status DestroyList();
	Status ClearList();
	Status ListEmpty();
	int ListLength();
	ElemType GetElem(int i);
	int LocateElem(ElemType e, bool (*)(ElemType, ElemType));
	ElemType PriorElem(ElemType cur_e);
	ElemType NextElem(ElemType cur_e);
	Status ListInsert(ElemType e);
	ElemType ListDelete(int i);
	Status ListTraverse(void (*func)(ElemType));
	void Show();
};

#endif
